package com.doit.day01.op

object MapDemo {
  def main(args: Array[String]): Unit = {
    val list: List[Int] = List(1, 2, 3, 4, 5, 6)

    val list1: List[Int] = list.map(_ * 10)

//    list1.foreach(println)



    //filter   filterNot
    //传进去得函数得返回值是一个布尔类型==>返回结果是true得数据
    val res: List[Int] = list.filter(_ > 3)
    val res1: List[Int] = list.filterNot(_ > 3)
//    res1.foreach(println)


    //max   min   sum    count
    val max: Int = list.max  //求一个最大值
    val min: Int = list.min  //求一个最小值
    val sum: Int = list.sum  //求集合中所有元素得和
    val count: Int = list.count(_>1) //计算满足条件得个数

    println(max)
    println(min)
    println(sum)
    println(count)




  }

}
